cmake_minimum_required(VERSION 3.20)
project(ts-common LANGUAGES CXX)

# 必须在 project() 之后设置
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Enable compile commands export" FORCE)

# 自动检测构建类型
if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type" FORCE)
endif()

# 设置 Conan 生成文件路径
set(CONAN_GENERATORS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/conan/${CMAKE_BUILD_TYPE}")

# 包含 Conan 工具链文件
if(EXISTS "${CONAN_GENERATORS_DIR}/conan_toolchain.cmake")
    include("${CONAN_GENERATORS_DIR}/conan_toolchain.cmake")
    message(STATUS "Using Conan toolchain: ${CONAN_GENERATORS_DIR}/conan_toolchain.cmake")
else()
    message(WARNING "Conan toolchain file not found at ${CONAN_GENERATORS_DIR}/conan_toolchain.cmake")
endif()

# 添加 Conan 生成目录到搜索路径
list(APPEND CMAKE_PREFIX_PATH "${CONAN_GENERATORS_DIR}")
set(CMAKE_MODULE_PATH "${CONAN_GENERATORS_DIR}" ${CMAKE_MODULE_PATH})



find_package(loguru REQUIRED)
find_package(fmt REQUIRED)




# ====================== 头文件库配置 ======================
# 创建接口库（头文件库）
add_library(ts-common INTERFACE)

# 将头文件添加到 INTERFACE 库中
target_include_directories(ts-common INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
# 如果头文件在 ts-common/include/utils 中，你可以指定具体的路径
target_include_directories(ts-common INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include/utils)

# 添加依赖库（作为接口依赖）
target_link_libraries(ts-common INTERFACE
    loguru::loguru
    fmt::fmt
)


# ====================== 可执行文件配置 ======================




# ====================== 安装配置 ======================

